import pointApi from "@/api/declaration/mall/pointApi"
import httpRequest from "@/config/axios/httpRequest"
import { PointActivityModel } from "@/models/mall/PointActivityModel"


// 积分商城活动 API
export const PointActivityApi = {
  // 查询积分商城活动分页
  getPointActivityPage: async (params: any) => {
    return await httpRequest.get(pointApi.GetPointActivityPage, { params })
  },

  // 查询积分商城活动详情
  getPointActivity: async (id: number) => {
    return await httpRequest.get(pointApi.GetPointActivity, { params: { id } })
  },

  // 查询积分商城活动列表，基于活动编号数组
  getPointActivityListByIds: async (ids: number[]) => {
    return httpRequest.get(pointApi.GetPointActivityListByIds, { params: { ids } })
  },

  // 新增积分商城活动
  createPointActivity: async (data: PointActivityModel) => {
    return await httpRequest.post(pointApi.CreatePointActivity, data)
  },

  // 修改积分商城活动
  updatePointActivity: async (data: PointActivityModel) => {
    return await httpRequest.put(pointApi.UpdatePointActivity, data)
  },

  // 删除积分商城活动
  deletePointActivity: async (id: number) => {
    return await httpRequest.delete(pointApi.DeletePointActivity, { params: { id } })
  },

  // 关闭秒杀活动
  closePointActivity: async (id: number) => {
    return await httpRequest.put(pointApi.ClosePointActivity, { id })
  }
}
